package com.springboot.annotation.conditional.config;

import com.springboot.annotation.conditional.condition.ObstinateCondition;
import com.springboot.annotation.conditional.condition.WindowsCondition;
import com.springboot.annotation.conditional.module.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: lzx
 * @Data: 2021/05/08/13:33
 * @Description：
 */
@Configuration
@Conditional({WindowsCondition.class, ObstinateCondition.class})
public class BeanConfig {
//    @Conditional({WindowsCondition.class})  方法上
    @Bean(name="bill")
    public Person person1() {
        return new Person("Bill Gates", 20);
    }
//    @Conditional({LinuxCondition.class})
    @Bean(name="linus")
    public Person person2() {
        return new Person("Linus", 21);
    }
}
